import { createSlice, createAsyncThunk } from '@reduxjs/toolkit'
import * as mapApi from '@renderer/api/map.api'

// { getMapList, getMapByName, removeMap }

export const getMapList = createAsyncThunk('map/getMapList', async () => {
  const { data } = await mapApi.getMapList()
  return data.message || []
})

export const mapSlice = createSlice({
  name: 'map',
  initialState: {
    mapList: []
  },
  reducers: {},
  extraReducers: (builder) => {
    builder.addCase(getMapList.fulfilled, (state, action) => {
      state.mapList = action.payload
    })
  }
})
// const { } = mapSlice.actions

// export { }

export default mapSlice.reducer
